﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using DotNetNuke.Entities.Modules;
using DNNToolkit.Modules.CityTaxLocator.Components;
using DotNetNuke.Common;
using DotNetNuke.Services.Localization;

namespace DNNToolkit.Modules.CityTaxLocator
{
    public partial class ViewDetail : PortalModuleBase
    {
        #region Privte Menbers
        private Int64 cityTaxID = 0;
        private Int64 CityTaxID
        {
            get
            {
                if (cityTaxID == 0 && Request.Params["CityTaxID"] != null)
                    cityTaxID = Convert.ToInt64(Request.Params["CityTaxID"]);
                return cityTaxID;
            }
        }
        #endregion

        #region Public Menbers
        private CityTaxInfo cityTaxInfo;
        /// <summary>
        /// Gets or sets the citytaxinfo.
        /// </summary>
        /// <value>The citytaxinfo.</value>
        public CityTaxInfo CityTax
        {
            get
            {
                if (cityTaxInfo == null)
                {
                    // get cityTaxInfo by id
                    CityTaxLocatorController controller = new CityTaxLocatorController();
                    cityTaxInfo = controller.GetCityTaxByID(CityTaxID);
                }
                return cityTaxInfo;
            }
            set { cityTaxInfo = value; }            
        }
        #endregion

        #region Private Method
        private void PopulateInfo()
        {
            // Populate edit Hyperlink
            mEditHyperlink.NavigateUrl = EditUrl("CityTaxID", CityTaxID.ToString());
            mEditHyperlink.Visible = IsEditable;

            // Populate the Return HyperLink
            mSearchHyperLink.NavigateUrl = Globals.NavigateURL(this.TabId);
        }
            
        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            PopulateInfo();

        }
    }
}